 Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved. 


         Oracle Multimedia Code Wizard for the 
         Oracle Application Server PL/SQL Gateway
         ========================================

This file describes the steps required to install and use the Oracle 
Multimedia Code Wizard for the Oracle Application Server PL/SQL Gateway 
(mod_plsql), hereafter referred to as the Code Wizard.  The Code Wizard
is installed from the Oracle Database Examples media which is available 
for download from Oracle Technology Network.

See the "Oracle Database Application Developer's Guide - Fundamentals, 
11g Release 2 (11.2)" or "Oracle HTTP Server Administrator's Guide 10g" for 
more information on managing PL/SQL web-based applications.


Contents
========

  Requirements
  About the Code Wizard
  What's New
  Installation and Configuration
  Using the Code Wizard
    Creating a new DAD or choosing an existing DAD for use with the Code Wizard
    Authorizing a DAD using the Code Wizard's administration function
    Creating and testing media upload and retrieval procedures
    Using PL/SQL Gateway document tables
    How time zone information is used to support browser caching
  Sample session
  Removing the Code Wizard
  Known restrictions


Requirements
============

Requirements for installing and using the Oracle Multimedia Code Wizard for 
mod_plsql.

Client component (choose one):
   - Oracle HTTP Server with PL/SQL Gateway (mod_plsql) installed.

     Oracle HTTP Server is distributed with Oracle Application Server 10g. It
     is also available as a separate download from Oracle Technology Network.

   - Oracle Embedded PL/SQL Gateway

     The embedded version of the PL/SQL gateway runs in the XML DB HTTP Listener
     in the database. It provides the core features of mod_plsql in the database
     but does not require the Oracle HTTP Server.     

Server component:
   Oracle Database 11g Release 2 (11.2) with Oracle Multimedia installed. 
  (Oracle Multimedia is installed by default.)


About the Code Wizard
=====================

The Oracle Multimedia Code Wizard for the PL/SQL Gateway is an example of 
a tool which creates PL/SQL procedures for the PL/SQL Gateway to upload
and retrieve media data stored in a database using the Oracle Multimedia 
object types.  The Code Wizard guides you through a series of 
self-explanatory steps to create either a media retrieval or media upload 
procedure.  You can either create and compile stand-alone media access 
procedures or you can generate the source of media access procedures for 
inclusion in a PL/SQL package.  Once created, you can customize the 
procedures as necessary to satisfy any specific application requirements.

What's New 11g Release 2
========================
The Code Wizard can now be configured and run using the Embedded PL/SQL 
Gateway of Oracle Database. The embedded version of the PL/SQL gateway runs 
in the XML DB HTTP Listener in the database. It provides the core features 
of mod_plsql in the database but does not require the Oracle HTTP Server.     


What's New 11g Release 1
========================
Prior versions of the Code Wizard required the use of ORDSYS as the username 
for the ORDCWADMIN Database Access Descriptor, or DAD. The ORDCWADMIN DAD is 
used to access the administrative features of the Code Wizard sample 
application. The ORDSYS account is now locked.

In this version, the user for the ORDCWADMIN DAD is specified when the
Code Wizard is installed. The installer will migrate the authorized DADs stored
in ORDSYS.OrdPlsGwyAuthedDADs to <CWADMINUSER>.OrdPlsGwyAuthedDADs

Be sure to read the installation and configuration sections carefully if you
are upgrading your Code Wizard application from a previous version.

Installation and Configuration
==============================

The Code Wizard is comprised of a PL/SQL package, ORDPLSGWYCODEWIZARD. 
The Code Wizard package must be installed in the ORDSYS schema.  For ease of 
use, a synonym, ORDCWPKG, is created for the ORDSYS.ORDPLSGWYCODEWIZARD 
package when you install the Code Wizard.

This section describes how to install and configure the Code Wizard packages
in a development database.

Note: If you have installed a prior version of the Code Wizard in a
database that has now been upgraded to Oracle Database 11g Release 2, you
may re-install this version of the Code Wizard. The prior Code Wizard 
application state will be automatically migrated during installation.


1. Choose a database username that will be the authorized administrator for 
   the Code Wizard. In the following instructions we will refer to this user
   as <CWADMINUSER>. However you should always substitute your chosen username
   whenever you encounter the <CWADMINUSER> symbol. The <CWADMINUSER> must have
   the "create session" and "create procedure" privileges.

2. Install the Code Wizard package.

   Start SQL*Plus and connect to the database with the SYSTEM username
   and password

->  SQL> connect SYSTEM[@<CONNECT_STRING>]
    Enter password: <password>

   Install the Code Wizard package:

->   SQL> @ordplsci.sql

   The script will prompt for the name of the user that will be authorized
   as the administrator user for the Code Wizard.

-->  Enter the authorized admin user for the Code Wizard:

   Enter your value for <CWADMINUSER>

   The installer will install the Code Wizard package. A log
   of the install session will be written to ordplsci.lst. 

   If you have not installed and used a previous version of the Code Wizard in 
   this database you will see the following message:

        -----Begin DAD migration---
        No DADs were found in the ORDSYS schema.
        No migration was performed.
        -----End DAD migration-----

   This message means that no migration was done and no further action is 
   required. Go to step 3 on how to create a DAD.

   If you have installed and used a previous version of the Code Wizard in this
   database then you will see a message that is similar to the following:

        -----Begin DAD migration---

        Now migrating these DAD/USER pairs from ORDSYS to SANDY
        ORDCWADMIN / ORDSYS
        JOEW / JOE
        
        The current DAD/USER list is:
        ORDCWADMIN / SANDY
        JOEW / JOE

        To complete the Code Wizard upgrade, proceed to the
        HTTP Server administration page and change the
        database username for the ORDCWADMIN DAD from
        ORDSYS to SANDY.
        
        See the README for more information.
        -----End DAD migration-----

   This message indicates that the application DADs that were authorized in 
   your previous version of the Code Wizard have been successfully migrated 
   to your new <CWADMINUSER> schema. In this example, <CWADMINUSER> is SANDY. 
   The message prompts you to complete the upgrade process by changing the 
   database username for the ORDCWADMIN DAD from ORDSYS to SANDY.  Go to step 
   4 on how to edit an existing DAD.


3. Create the Code Wizard administration Database Access Descriptor (DAD).

                               IMPORTANT
                               ---------

        All Code Wizard administration functions, such as the
        authorization of other DADs to use the Code Wizard, must
        execute using the <CWADMINUSER> user.  Do not enter a password
        for the Code Wizard administration DAD.  Omitting the
        password from the administration DAD requires users to
        enter a password to access the administration functions,
        thus ensuring access by authorized users only.  Note that
        the Code Wizard's administration functions check the DAD
        name with which they are invoked to ensure it is the
        ORDCWADMIN DAD created in these instructions.

***
*** If you are using Oracle Application Server 10g, or the Oracle HTTP Server 
*** standalone, then skip step 3.1 and proceed to step 3.2. If you wish to run 
*** the application using the Embedded PL/SQL Gateway of Oracle Database,
*** then proceed to step 3.1
***

3.1 Create a Database Access Descriptor (DAD) for the Code Wizard.
    Use when configuring with Embedded PL/SQL Gateway for Oracle Database.

-> Using SQL*Plus, run the following block of code from an account with the  
   XDBADMIN role. First change the value of variable "cw_admin" to the schema
   name where you have installed the application.

   ***** BEGIN CODE BLOCK
   declare
     -- Change schema name for your application.
     cw_admin varchar2(30) := '<CWADMINUSER>'; 
   begin
     dbms_epg.create_dad('CW_ADMIN', '/ordcwadmin/*');
     dbms_epg.set_dad_attribute('CW_ADMIN', 'database-username', cw_admin);
     dbms_epg.set_dad_attribute('CW_ADMIN', 'authentication-mode', 'Basic');
     dbms_epg.set_dad_attribute('CW_ADMIN', 'default-page', 'ORDCWPKG.MENU');
   end;
   /
   ***** END CODE BLOCK
  
-> Run the command 
   SQL> <ORACLE_HOME>/rdbms/admin/epgstat.sql 
   to verify the configuration for the Embedded PL/SQL Gateway.

***
*** If you completed step 3.1, then skip step 3.2 and proceed to "Using the 
*** Code Wizard". If you have installed Oracle Application Server 10g or 
*** the Oracle HTTP Server, proceed to step 3.2.
***

3.2 Create a Database Access Descriptor (DAD) for the Code Wizard:
    (HTTP Server from the companion CD of Oracle Database 11g)
    
-> Edit the DAD configuration file 

   For Oracle HTTP Server standalone 
     UNIX:    OHS_HOME/ohs/modplsql/conf/dads.conf
     Windows: OHS_HOME\ohs/modplsql\conf\dads.conf

   where OHS_HOME is the directory path for the root of the Oracle
   HTTP Server installation.

   For Oracle Application Server 10g
     UNIX:    OAS_HOME/Apache/modplsql/conf/dads.conf
     Windows: OAS_HOME\Apache/modplsql\conf\dads.conf

   where OAS_HOME is the directory path for the root of the Oracle Application 
   Server 10g installation.

   Add the following definition to the dads.conf file, replacing the strings
   <CWADMINUSER> and <CONNECT_STRING> with the correct values for your
   installation. Note that the <CWADMINUSER> must be the same schema name that 
   you chose in step 1.

     <Location /ordcwadmin>
       SetHandler pls_handler
       Order deny,allow
       Allow from all
       AllowOverride None
       PlsqlDatabaseUsername          <CWADMINUSER>
       PlsqlDatabaseConnectString     <CONNECT_STRING>
       PlsqlAuthenticationMode        Basic
       PlsqlDefaultPage               ORDCWPKG.MENU
     </Location>

   The following is an example DAD for when <CWADMINUSER> is SANDY:

     <Location /ordcwadmin>
       SetHandler pls_handler
       Order deny,allow
       Allow from all
       AllowOverride None
       PlsqlDatabaseUsername          sandy
       PlsqlDatabaseConnectString     fastbox:1521:orcl ServiceNameFormat
       PlsqlAuthenticationMode        Basic
       PlsqlDefaultPage               ORDCWPKG.MENU
     </Location>

   Note that this example uses the ServiceNameFormat, HOST:PORT:SERVICE_NAME, 
   to define the database connect string. Other formats for defining the
   database connect string are: SIDFormat, TNSFormat and NetServiceNameFormat.
   The file OAS_HOME/Apache/modplsql/conf/dads.README explains how
   to use these other formats. It also documents DAD creation in general.

-> Save the edits to the file dads.conf.

-> Restart the Oracle HTTP Server for the configuration to take effect.

Using the Code Wizard
=====================

Follow these steps to use the Code Wizard to create and test media upload
and retrieval procedures:

1. Create a new DAD or choose an existing DAD for use with the Code Wizard
2. Authorize use of the DAD using the Code Wizard's administration function
3. Create and test media upload and retrieval procedures

This section covers the following topics:

- Creating a new DAD or choosing an existing DAD for use with the Code Wizard
- Authorizing a DAD using the Code Wizard's administration function
- Creating and testing media upload and retrieval procedures
- Using PL/SQL Gateway document tables
- How time zone information is used to support browser caching


A. Creating a new DAD or choosing an existing DAD for use with the Code Wizard
------------------------------------------------------------------------------

To create media upload or retrieval procedures, you must select one or
more DADs for use with the Code Wizard.  To prevent the unauthorized
browsing of schema tables and to prevent the unauthorized creation of
media access procedures, you must authorize each DAD using the Code
Wizard's administration function.  Depending on your database and
application security requirements, you may choose to create and authorize
one or more new DADs specifically for use with the Code Wizard, or you may
choose to authorize the use of one or more existing DADs.

Oracle recommends that any DAD authorized for use with the Code Wizard
uses some form of user authentication mechanism.  The simplest approach is
to create or use a DAD that uses database authentication.  To use this
approach, select the Basic Authentication Mode and omit the Password in
the DAD specification.  Alternatively, you may choose to use a DAD that
specifies an existing application-specific authentication mechanism.

See the "Oracle Database Application Developer's Guide - Fundamentals, 
11g Release 2 (11.2)" book or "Oracle HTTP Server Administrator's Guide 10g" 
for more information on configuring DADs.

The following example illustrates how to create a DAD to create and test
media upload and retrieval procedures in the SCOTT schema.

Note: To test media upload procedures, the name of a document table must
      be specified in the DAD.  When testing an upload procedure, you may
      choose the DAD you use to create the procedure, or you may use the
      DAD used to access the application.  You may choose a document table
      name when you create a DAD, edit a DAD to specify the document table
      name at a later time, or use an existing DAD that already specifies
      a document table name. This example illustrates specifying the
      document table name when you create the DAD.

-> Edit the DAD configuration file 

   For Oracle HTTP Server standalone 
     UNIX:    OHS_HOME/ohs/modplsql/conf/dads.conf
     Windows: OHS_HOME\ohs/modplsql\conf\dads.conf

   where OHS_HOME is the directory path for the root of the Oracle
   HTTP Server installation.

   For Oracle Application Server 10g
     UNIX:    OAS_HOME/Apache/modplsql/conf/dads.conf
     Windows: OAS_HOME\Apache/modplsql\conf\dads.conf

   where OAS_HOME is the directory path for the root of the Oracle Application 
   Server 10g installation.

   Add the following definition to the dads.conf file, replacing the strings
   <CWUSER> and <CONNECT_STRING> with the correct values for your
   installation. 

     <Location /cwuser>
       SetHandler pls_handler
       Order deny,allow
       Allow from all
       AllowOverride None
       PlsqlDatabaseUsername          <CWUSER>
       PlsqlDatabaseConnectString     <CONNECT_STRING>
       PlsqlAuthenticationMode        Basic
       PlsqlDefaultPage               ORDCWPKG.MENU
     </Location>

   The following is an example DAD for when <CWUSER> is RACHEL:

     <Location /cwuser>
       SetHandler pls_handler
       Order deny,allow
       Allow from all
       AllowOverride None
       PlsqlDatabaseUsername          RACHEL
       PlsqlDatabaseConnectString     fastbox:1521:orcl ServiceNameFormat
       PlsqlAuthenticationMode        Basic
       PlsqlDefaultPage               ORDCWPKG.MENU
       PlsqlDocumentTablename         MEDIA_UPLOAD_TABLE
     </Location>

-> Save the edits to the file dads.conf.

-> Restart the Oracle HTTP Server for the configuration to take effect.

B. Authorizing a DAD using the Code Wizard's administration function
--------------------------------------------------------------------

To authorize a DAD for use with the Code Wizard, enter the Code Wizard's
administration URL into your browser's location bar, then enter the 
<CWADMINUSER> username and password when prompted by the browser.  For example:

  http://host:port/ordcwadmin

Select the "DAD authorization" function from the main menu, then click the
"Next" button.  Type in the name of the DAD you wish to authorize together
with the user name, then click the "Apply" button.  Note that duplicate
DADs are not allowed and each authorized DAD must indicate which database
schema the user is authorized to access with the Code Wizard using the
DAD.  Use this same screen to delete the authorization for any existing
DADs that no longer need to use the Code Wizard.

To log out (clear HTTP authentication information), select the "Logout"
function from the main menu, then click the "Next" button.  The log out
function redirects the request to the PL/SQL Gateway's built-in "logmeoff"
function.  See the PL/SQL Gateway documentation for more information.


C. Creating and testing media upload and retrieval procedures
-------------------------------------------------------------

To start the Code Wizard, enter the appropriate URL into your browser's
location bar, then enter the user name and password when prompted by the
browser.  If the DAD is configured specifically for use with the Code
Wizard, simply enter the DAD name. Alternatively, to use another DAD,
enter the DAD name together with Code Wizard package name and main menu
procedure name, ORDCWPKG.MENU, after the DAD name.  For example:

  http://host:port/scottcw

           -- or --

  http://host:port/mediadad/ordcwpkg.menu

Once logged in, you can log out (clear HTTP authentication information) at
any time by selecting the "Logout" function from the main menu, then
clicking the "Next" button.  The log out function redirects the request to
the PL/SQL Gateway's built-in "logmeoff" function.  See the PL/SQL Gateway
documentation for more information.

To create a media retrieval or upload procedure, select the appropriate
function, then click the "Next" button.  The Code Wizard then guides you
through a series of self-explanatory steps to create the procedure.  Each
step includes explanatory text that describes how to proceed.  

If you create a stand-alone media upload or retrieval procedure, you will
have the opportunity to test the procedure at the end.

A sample session described later in this document illustrates how to
create and test a media upload procedure and a media retrieval procedure.


D. Using PL/SQL Gateway document tables
---------------------------------------

All files uploaded using the PL/SQL Gateway are stored in a document
table.  Media upload procedures created by the Code Wizard automatically
move uploaded media from the specified document table to the application's
table.  To avoid transient files appearing temporarily in a document table
used by another application component, use a document table that is not
being used to store documents permanently.

Be sure to specify the selected document table in the application's
Database Access Descriptor (DAD).  If the DAD already specifies a
different document table, create a new DAD for media uploads.

If you choose to create a new document table, the Code Wizard will create
a table with the following format:

  CREATE TABLE document-table-name
    ( name           VARCHAR2(256) UNIQUE NOT NULL,
      mime_type      VARCHAR2(128),
      doc_size       NUMBER,
      dad_charset    VARCHAR2(128),
      last_updated   DATE,
      content_type   VARCHAR2(128),
      blob_content   BLOB );

See the "Oracle Database Application Developer's Guide - Fundamentals, 
11g Release 2 (11.2)" book or "Oracle HTTP Server Administrator's Guide 10g" 
for more information on file upload and document tables.


E. How time zone information is used to support browser caching
---------------------------------------------------------------

User response times are improved and network traffic is reduced if a
browser can cache resources received from a server and subsequently use
those cached resources to satisfy future requests.  This section descibes
at a very high level how the browser caching mechanism works and how the
Oracle Multimedia utility package, ORDPLSGWYUTIL, supports that mechanism.  
When reading this discussion, note that all HTTP date/time stamps are 
expressed in Greenwich Mean Time (GMT).

All HTTP responses include a Date header, which indicates the date and
time when the response was generated.  When a server sends a resource in
response to a request from a browser, it can also include the
Last-Modified HTTP response header, which indicates the date and time when
the requested resource was last modified.  It is important to note that
the Last-Modified header must not be later than the Date header. 

After receiving and caching a resource, if a browser needs to retrieve the
same resource again, it sends a request to the server with the
If-Modified-Since request header specified as the value of the
Last-Modified date returned by the server when the resource was previously
retrieved and cached.  When the server receives the request, it compares
the date in the If-Modified-Since request header with the last update time
of the resource.  Assuming the resource still exists, if the resource
hasn't changed since it was cached by the browser, the server responds
with an HTTP 304 Not Modified status with no response body, which
indicates that the browser can use the resource currently stored in its
cache.  Assuming once again the resource still exists, if the request
does not include an If-Modified-Since header or if the resource has been
updated since it was cached by the browser, the server responds with an
HTTP 200 OK status and sends the resource to the browser.  See the HTTP
specification for more information.

The ORDImage, ORDAudio, ORDVideo and ORDDoc objects all possess an
updateTime attribute stored as a DATE in the embedded ORDSource object.
Although the DATE datatype has no support for time zones or daylight
savings time, the Oracle Database 11g does support time zones and also 
provides functions for converting a DATE value stored in a database to GMT.  
Consult the "Oracle Database Administrator's Guide 11g" book for more 
information on how to set a time zone for a database. See the "Oracle Database 
SQL Reference 11g" book for more information on datetime functions.

When a response is first returned to a browser, a media retrieval
procedure sets the Last-Modified HTTP response header based on the
updateTime attribute.  If a request for media data includes an
If-Modified-Since header, the media retrieval procedure compares the value
with the updateTime attribute and returns an appropriate response.  If the
resource in the browser's cache is still valid, an HTTP 304 Not Modified
status is returned with no response body.  If the resource has been
updated since it was cached by the browser, then an HTTP 200 OK status is
returned with the media resource as the response body.

Media retrieval procedures created by the Code Wizard call the Oracle 
Multimedia utility package, ORDPLSGWYUTIL, to convert a DATE value stored 
in the database to GMT. The utility package uses the time zone information 
of the Oracle Database and the datetime functions to convert a database 
date/time stamp to GMT. To ensure the resulting date conforms to the rule 
for the Last-Modified date described earlier, the time zone information must 
be specified correctly. Consult the "Oracle Database Administrator's Guide 
11g" book for more information on how to set a time zone for a database.


Sample session
==============

This sample session uses the SCOTT schema to illustrate the creation of
media upload and retrieval procedures.  Substitute a different schema name
to use a different schema.

This script assumes the Code Wizard has been installed.

1. Create a table to store images for the sample application.

   Start SQL*Plus and connect to the SCOTT schema in the database:

->  SQL> connect SCOTT[@<CONNECT_STRING>]
    Enter password: <password>

   Create the table:

->   SQL> CREATE TABLE cw_images_table( id NUMBER PRIMARY KEY,
                                        description VARCHAR2(30) NOT NULL,
                                        location VARCHAR2(30),
                                        image ORDSYS.ORDIMAGE );


2. Create the SCOTTCW DAD to be used to create the procedures. This example
   is for use with the Embedded PL/SQL Gateway. If you are using Oracle HTTP Server
   then adapt the instructions given earlier in Section 3.2 of 
   Installation and Configuration.

   Using SQL*Plus, execute the following code block form the SYSTEM account:

   ***** BEGIN CODE BLOCK
   declare
     cw_user varchar2(30) := 'SCOTT'; 
   begin
     dbms_epg.create_dad('SCOTTW_DAD', '/scottw/*');
     dbms_epg.set_dad_attribute('SCOTTW_DAD', 'database-username', cw_user);
     dbms_epg.set_dad_attribute('SCOTTW_DAD', 'authentication-mode', 'Basic');
     dbms_epg.set_dad_attribute('SCOTTW_DAD', 'default-page', 'ORDCWPKG.MENU');
     dbms_epg.set_dad_attribute('SCOTTW_DAD', 'document-table-name', 
                                'CW_SAMPLE_UPLOAD_TABLE');
   end;
   /
   ***** END CODE BLOCK


3. Authorize the use of the SCOTTCW DAD and SCOTT schema with the Code Wizard.

   Enter the Code Wizard's administration URL into your browser's location
   bar, then enter the <CWADMINUSER> user name and password when prompted by 
   the browser.  For example:

     http://host:port/ordcwadmin

   Select the DAD authorization function from the Code Wizard's main menu
   and click the Next botton.  Type in the name of the sample application DAD,
   SCOTTCW, and the SCOTT user name, then click the "Apply" button.  Click
   the "Done" button when the confirmation screen is displayed.


4. Change DADs to the SCOTTCW DAD.

   Select the Change DAD function from the Code Wizard's main menu.
   Select the SCOTTCW DAD, if it is not already selected, then click the
   "Next" button.  The browser will then prompt you for the user name and
   password. Enter SCOTT and TIGER, then press the "OK" button.  The main
   menu now displays the Current DAD as SCOTTCW and the current schema as
   SCOTT2.


5. Create and test a media upload procedure.

   Select the "Create media upload procedure" function from the main menu,
   then click the "Next" button.

   Step 1: Select database table and procedure type 

     - Select the CW_IMAGES_TABLE database table.
     - Select the "Standalone procedure" button.
     - Click the "Next" button.

   Step 2: Select PL/SQL Gateway document upload table 

     - If there are no document tables in the SCOTT schema, the Code
       Wizard displays a message indicating the situation. In this case,
       enter CW_SAMPLE_UPLOAD_TABLE in "Table name:" box and then click 
       the "Next" button.

     - If there are existing document tables, but the CW_SAMPLE_UPLOAD_TABLE
       is not among them, select the "Create new document table" button and
       enter CW_SAMPLE_UPLOAD_TABLE in "Table name:" box and then click 
       the "Next" button.

     - If the CW_SAMPLE_UPLOAD_TABLE document table already exists, the
       "Use existing document table" and CW_SAMPLE_UPLOAD_TABLE buttons
       are checked already. Simply click the "Next" button.

   Step 3: Select data access and media column(s) 

     - The checkbox for the "IMAGE (ORDIMAGE)" column is checked already.
     - The "ID (Primary key)" column button is checked already.
     - Select the "Conditional insert or update" button.
     - Click the "Next" button.

   Step 4: Select additional columns and procedure name 

     - The checkbox for the "DESCRIPTION" column is checked already as
       this column has a NOT NULL constraint. (The checkbox for the 
       "LOCATION" column is not checked by default as there are no
       constraints on this column.)
     - Accept the procedure name provided, UPLOAD_CW_IMAGES_TABLE_IMAGE.
     - The "Create procedure in the database" button is checked already. 
     - Click the "Next" button.

   Step 5: Review selected options 

     - The following procedure creation options are displayed:
         Procedure type:        Standalone
         Table name:            CW_IMAGES_TABLE
         Media column(s):       IMAGE (ORDIMAGE)
         Key column:            ID
         Additional column(s):  DESCRIPTION
         Table access mode:     Conditional update or insert
         Procedure name:        UPLOAD_CW_IMAGES_TABLE_IMAGE
         Function:              Create procedure in the database
     - Click the "Next" button.

   Final step: Compile procedure and review generated source 

     - The Code Wizard displays the following message:
         "Procedure created successfully: UPLOAD_CW_IMAGES_TABLE_IMAGE"
     - Click the "View" button to view the generated source in a pop-up
       window. Close the window after looking at the generated source.
     - Accept the DAD name provided, SCOTTCW, then click the "Test" button
       to display a template file upload HTML form in a pop-up window that
       you can use to test the generated procedure:
       - To customize the template file upload form, select "Save As..."
         from your browser's "File" pull-down menu to save the HTML source
         for editing.
       - Enter the number 1 for the ID column as the row's primary key
       - Click on the "Browse..." button and choose an image file to
         upload to the database.
       - Enter a description of the image.
       - Click the "Upload media" button.
       - The upload procedure displays a template completion page.
       - Close the pop-up window.
     - Click the "Done" button to return to the main menu.


6. Create and test a media retrieval procedure.

   Select the "Create media retrieval procedure" function from the main
   menu, then click the "Next" button.

   Step 1: Select database table and procedure type 

     - Select the CW_IMAGES_TABLE database table.
     - Select the "Standalone procedure" button.
     - Click the "Next" button.

   Step 2: Select media column and key column 

     - The "IMAGE (ORDIMAGE)" column button is checked already.
     - The "ID (Primary key)" column button is checked already.
     - Click the "Next" button.

   Step 3: Select procedure name and parameter name 

     - Accept the procedure name provided, GET_CW_IMAGES_TABLE_IMAGE.
     - Accept the parameter name provided, MEDIA_ID.
     - The "Create procedure in the database" button is checked already. 
     - Click the "Next" button.

   Step 4: Review selected options 

     - The following procedure creation options are displayed:
         Procedure type:  Standalone
         Table name:      CW_IMAGES_TABLE
         Media column:    IMAGE (ORDIMAGE)
         Key column:      ID
         Procedure name:  GET_CW_IMAGES_TABLE_IMAGE
         Parameter name:  MEDIA_ID
         Function:        Create procedure in the database
     - Click the "Next" button.

   Final step: Compile procedure and review generated source 

     - The Code Wizard displays the following message:
         "Procedure created successfully: GET_CW_IMAGES_TABLE_IMAGE"
     - Click the "View" button to view the generated source in a pop-up
       window. Close the window after looking at the generated source.
     - Review the URL format used to retrieve images using the
       GET_CW_IMAGES_TABLE_IMAGE procedure.
     - Enter 1 as the Key paremeter, then click the "Test" button to
       test the procedure by retrieving the image uploaded earlier.
       - The uploaded image is displayed in a pop-up window.
       - Close the pop-up window.
     - Click the "Done" button to return to the main menu.


Removing the Code Wizard
========================
You can use the SQL script ordplsrm.sql to drop all schema objects created
by the Code Wizard application.

   Start SQL*Plus and connect to the database using the SYSTEM account.

->  SQL> connect SYSTEM[@<CONNECT_STRING>]
    Enter password: <password>

   Remove the Code Wizard package:

->   SQL> @ordplsrm.sql

   The script will prompt for the name of the user that was chosen to be 
   the authorized administrator user for the Code Wizard when it was
   installed.

-->  Enter the authorized admin user for the Code Wizard:

   Enter your value for <CWADMINUSER>

Known restrictions
==================

1. Tables with composite primary keys are not supported.

   To use a table with a composite primary key, create an upload or
   download procedure, then edit the generated source to support all the
   primary key columns.  For example, for a media retrieval procedure,
   this might involve adding an additional parameter, then specifying that
   parameter in the WHERE clause of the SELECT statement.

2. User object types containing embedded Oracle Multimedia object types are 
   not recognized by the Code Wizard.

